import request from '@/utils/request'
//创建轮播图
export const admincreateCarousel = ({
  title,
  imageUrl,
  linkUrl,
  sortOrder
}) => {
  console.log('请求数据:', { title, imageUrl, linkUrl, sortOrder })
  // 返回 request.post 的 Promise，这样调用者就可以等待响应
  return request.post('/web/admin/carousel/create', {
    title,
    imageUrl,
    linkUrl,
    sortOrder
  })
}

//根据id查询轮播图
export const adminQueryCarouselByIdService = (id) => {
  console.log(id)
  return request.get(`/web/admin/carousel/${id}`)
}

//分页查询轮播图
export const adminQueryCraouselService = ({ pageNo, pageSize }) =>
  request.get('/web/admin/carousel/page', {
    params: {
      pageNo,
      pageSize
    }
  })

//更新轮播图
export const adminUpdateCraouselService = ({
  id,
  title,
  imageUrl,
  linkUrl,
  sortOrder,
  activeStatus,
  deleted
}) =>
  request.put('/web/admin/carousel/update', {
    id,
    title,
    imageUrl,
    linkUrl,
    sortOrder,
    activeStatus,
    deleted
  })
